import React, { Component } from 'react'
import { Button } from 'antd-mobile'
import Personalcenter from '../../components/personalcenter/Personalcenter'
import './My.scss'
const navarr = [
	{ img: require('../../images/person.png'), title: '员工管理', router: '/employeemanagement' },
	{ img: require('../../images/stock.png'), title: '设备库存' },
	{ img: require('../../images/commodity.png'), title: '商品管理' },
	{ img: require('../../images/myorder.png'), title: '平台进货对账', router: '/Platformreconciliation' },
	{ img: require('../../images/yeji.png'), title: '销售业绩中心', router: '/performance' },
	{ img: require('../../images/yeji1.png'), title: '安装工业绩', router: '/performance1' },
	{ img: require('../../images/evaluationcolor.png'), title: '客户评价' },
]
class My extends Component {
	constructor(props) {
		super(props);
		this.state = {
			islogin: true
		}
	}
	render() {
		return (
			<div className='my'>
				{/* 个人中心 */}
				{
					this.state.islogin ?
						<Personalcenter />
						:
						<div className='top' style={{ alignItems: 'center' }}>
							<div className='avatorbox'>
								<img className='avator' src='../../images/unlogin.png' alt='' />
							</div>
							<Button
								className='but'
								style={{ backgroundColor: '#fff', color: '#4d638c' }}
								onClick={() => {
									this.props.history.push({
										pathname: '/login',
									})
								}}>登录</Button>
							<Button
								className='but'
								style={{ backgroundColor: '#4d638c', color: '#fff' }}
								onClick={() => {
									this.props.history.push({
										pathname: '/register',
									})
								}}>注册</Button>
							<img
								alt=''
								className='setting'
								src={require('../../images/setting.png')} alt="" />
						</div>
				}
				{/* 推广 */}
				<div className='promotion'>
					<img src='' alt='' />
				</div>
				{/* 设置模块 */}
				<div className='settingitembox'>
					<div className='item1 border-b'>
						<div className='lborder'></div>
						我的订单
					</div>
					<div className='item2'>
						<div className='devicename rowcenter border-b'
							onClick={() => {
								this.props.history.push({
									pathname: '/salesorder'
								})
							}}>
							<img src={require('../../images/order.png')} alt="" />
							<span style={{ color: '#333', flex: 1 }}>售卖订单列表</span>
							<img className='more' src={require('../../images/arrow_icon.png')} alt="" />
						</div>
						<div className='devicename rowcenter'
							onClick={() => {
								this.props.history.push({
									pathname: '/reservationserviceorder'
								})
							}}>
							<img src={require('../../images/service.png')} alt="" />
							<span style={{ color: '#333', flex: 1 }}>安装/维修中心</span>
							<img className='more' src={require('../../images/arrow_icon.png')} alt="" />
						</div>
					</div>
				</div>

				<div className='settingitembox' style={{ marginBottom: '10px' }}>
					<div className='item1 border-b'>
						<div className='lborder'></div>
						管理工具
				</div>
					<div className='item3'>
						{
							navarr.map((item, index) => {
								return (
									<div key={index}
										className='navitem border-b'
										style={{
											borderRightWidth: index === 3 ? 0 : 1,
											borderBottomWidth: index <= 3 ? 1 : 0
										}}
										onClick={() => {
											this.props.history.push({
												pathname: item.router
											})
										}} >
										<img src={item.img} alt='' />
										<div className='navtitle'>{item.title}</div>
									</div>
								)
							})
						}
					</div>
				</div>
			</div>
		)
	}
}
export default My;